package com.aaa.sbms.controller;

import com.aaa.sbms.service.SalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("sal")
public class SalController {

    @Autowired(required = false)
    private SalService salService;

    /**
     * 查询职位
     * @return
     */
    @RequestMapping("positions")
    public Map positions(){
        return salService.positions();
    }

    /**
     * 分页查询职位工资
     * @param map
     * @return
     */
    @RequestMapping("salPage")
    public Map salPage(@RequestParam Map map){
        return salService.salPage(map);
    }

    /**
     * 分页查询工资结算
     * @param map
     * @return
     */
    @RequestMapping("salOnTimePage")
    public Map salOnTimePage(@RequestParam Map map){
        return salService.salOnTimePage(map);
    }

    /**
     * 根据id查询一条职位薪资记录
     * @param id
     * @return
     */
    @RequestMapping("salOne")
    public Map salOne(Integer id){
        return salService.salOne(id);
    }

    /**
     * 根据id查询一条职位薪资记录
     * @param map
     * @return
     */
    @RequestMapping("updateSal")
    public int updateSal(@RequestBody Map map){
        return salService.updateSal(map);
    }
}
